#include<bits/stdc++.h>
#define int long long 
using namespace std;
int n,k,mod=998244353;
int a[1000005];
int jc[2000005];
int inv[2000005];
int ans;
inline int poww(int x,int y){
	int sum=1;
	while(y){
		if(y&1)sum=(sum*x)%mod;
		x=(x*x)%mod;
		y>>=1;
	}
	return sum;
}
inline int C(int n,int m){
	return (jc[n]*inv[m]%mod)*inv[n-m]%mod;
}
inline int w(int x,int y){
	return C(k-x-1+y,y);
}
signed main(){
	freopen("count.in","r",stdin);
	freopen("count.out","w",stdout);
	cin>>n>>k;
	jc[0]=1;
	for(int i=1;i<=n+k;i++)jc[i]=(jc[i-1]*i)%mod;
	for(int i=0;i<=n+k;i++)inv[i]=poww(jc[i],mod-2);
	for(int i=n;i>0;i--)cin>>a[i];
	for(int i=n;i>0;i--){
		if(i<n&&a[i]<a[i+1]){
			cout<<(ans-1+mod)%mod<<endl;
			return 0;
		}
		if(a[i]>a[i+1]||i==n)
			for(int j=a[i+1];j<a[i];j++)
				ans=(ans+w(j,i-1))%mod;
	}
	ans=(ans+w(a[1],0))%mod;
	cout<<(ans-1+mod)%mod<<endl;
	return 0;
}
